How to Use Netsh Interface IP Set Address or DNS in CMD |
您所在的位置:网站首页 › netsh interface ipv4 show › How to Use Netsh Interface IP Set Address or DNS in CMD |
Windows Command Prompt, or CMD, can be a handy tool for tweaking network settings. It lets you change IP addresses and DNS settings with commands like “netsh interface ip set address” and “netsh interface ip set dns“. This guide will show you how to do just that in Windows 11 or 10 using either CMD or PowerShell. Also see: How to Check IP Address in Windows 11 Page Contents Getting to know the “Netsh Interface IP” commandNetsh, or “network shell,” is a command-line tool in Windows that helps you manage network settings. It’s great for working with IP addresses and DNS settings. You can use netsh interface ip to handle IP addresses and netsh interface ip set dns for DNS configuration. Related concern: What is Netsh.exe & its Popup and Crashing issues in Windows 11 Why use the command line?Although many would argue that it would be more convenient to just adjust things through the GUI available like the network adapter’s properties to configure things like IP addresses and DNS, using command line, particularly the Netsh tool, will give you more freedom and some benefits: It’s quick. Commands run faster than navigating through menus. Great for automation. You can script these commands to set up many computers at once. Handy for remote management. Manage settings on computers across your network from anywhere. Helpful for troubleshooting. Get detailed info that can help fix network problems.Pro tip: How to Find The IP Address of a Website in Windows 10 / 11 How to assign a Static IP AddressSetting a static IP address is useful for devices that need a constant address, like servers. Here’s how to do it with CMD: First up, open Command Prompt as an adminHit the Win key, search for cmd or Command Prompt, right-click the result, and pick Run as administrator. PowerShell works too. Type this to list them: netsh interface ipv4 show interfacesFind the one you’re working with and remember its index number. Use this template, swapping in your own values: netsh interface ipv4 set address name= source=static address= mask= gateway=For instance, to assign 192.168.1.10 to interface number 3, you’d type: netsh interface ipv4 set address name=3 source=static address=192.168.1.10 mask=255.255.255.0 gateway=192.168.1.1Type ipconfig to see if your new settings are listed.
Dynamic IP addresses, given out by a DHCP server, are the go-to for most networks. Here’s how to set one up: Step 1: Open Command Prompt as an administratorJust like before. Step 2: View the list of network interfacesRun netsh interface ipv4 show interfaces to see your options and pick one. Step 3: Switch to DHCPHere’s the command, don’t forget to use your interface’s index: netsh interface ipv4 set address name= source=dhcpFor example, for interface 3, it’s: netsh interface ipv4 set address name=3 source=dhcpRun ipconfig to see if it’s set to get an IP address by itself. Additional resource: Find MAC Address on Windows 11/10 with or without CMD Setting up DNS SettingsDNS settings are what turn website names into IP addresses. Here’s how to tweak them: See also: Change DNS to Google or Cloudflare in Windows 11/10 Step 1: Open Command Prompt as an administratorAs mentioned earlier. Step 2: View the list of network interfacesUse netsh interface ipv4 show interfaces to find the one to configure. Step 3: Pick a primary DNS serverReplace the placeholders with your actual details: netsh interface ipv4 set dns name= static primaryTo use 8.8.8.8 as your primary DNS on interface 3: netsh interface ipv4 set dns name=3 static 8.8.8.8 primaryHere’s how, just change and to fit your setup: netsh interface ipv4 add dns name= addr= index=2To set 8.8.4.4 as a backup for interface 3: netsh interface ipv4 add dns name=3 addr=8.8.4.4 index=2 Step 5: Double-check everythingRun ipconfig /all to make sure your DNS settings are spot on. If you want your DNS settings to go back to automatic, here’s what to do: Step 1: Open Command Prompt as an administratorSame process as before. Step 2: View the list of network interfacesCheck your interfaces again with netsh interface ipv4 show interfaces. Step 3: Reset your DNS settingsHere’s how, remember to swap in your interface index: netsh interface ipv4 set dns name= source=dhcpTo reset interface 3‘s DNS: netsh interface ipv4 set dns name=3 source=dhcpRun ipconfig /all to see if your computer is back to getting DNS settings on its own. My two centsUsing the “netsh interface ip set address” and “netsh interface ip set dns” in CMD to adjust IP and DNS settings on Windows is especially useful when you need to manage a big network. If you are looking to automate stuffs like setting IP and DNS for a lot of computers in the network, this will certainly be one of the best ways. ![]() Tip: Ping IPv4 Address Instead of IPv6 in Windows 11/10 CMD MoreRead: How to Ping IPv6 Address in Windows 11 How to Check IP Address in Windows 11 Categories: NetworkWindows 10Windows 11 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |